package tanxin;

public class item55 {
    public boolean canJump(int[] nums) {
        if(nums.length==1) return true;
        if(nums.length>1&&nums[0]==0) return false;
        int rightMost = nums[0];
        for (int i = 1; i < nums.length ; i++) {
            if(i<=rightMost)
            {
                rightMost = Math.max(rightMost,nums[i]+i);
            }
            if(rightMost>= nums.length-1)
            {
                return true;
            }
        }

    return false;
    }
}
